﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ch4_general
{
    class Girlfriend<T1>: IComparable
    {
        string name;
        int duration;
        T1 meetingDate;
        public Girlfriend(string name, int duration, T1 meetingDate)
        {
            this.name = name;
            this.duration = duration;
            this.meetingDate = meetingDate;
        }
        public void show()
        {
            Console.WriteLine("name={0},duration={1}, meetingDate={2}", 
                name, duration,meetingDate);
        }

        public int CompareTo(object gf)
        {
            if (this.duration > ((Girlfriend<DateTime>)gf).duration)
                return 1;
            else if (this.duration == ((Girlfriend<DateTime>)gf).duration)
                return 0;
            else return -1;
        }
    }
}
